package com.wnn.demo.model.system.mapper;

import com.wnn.demo.domain.Permission;
import com.wnn.demo.domain.Role;
import com.wnn.demo.domain.RoleAndPerm;
import com.wnn.demo.utils.IBaseMapper;
import com.wnn.demo.vo.MenuTreeVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;


/**
* Created by Mybatis Generator on 2019/08/31
*/
public interface RoleMapper extends IBaseMapper<Role> {


    List< RoleAndPerm > findRoleAndPermList(@Param("roleId") String roleId, @Param("parentMenuId") String parentMenuId);



    List<Role> selectRoleByIds(@Param("ids") String ids);


    /**
     * 批量删除角色
     * @param roles
     * @return
     */
    int batchDeleteRoleByList(@Param("roles") List< Role> roles);


    /**
     * 批量分配 角色权限表
     * @param roleId
     * @param mapList
     * @return
     */
    int batchInsertRoleAndPerm(@Param("roleId") String roleId, @Param("mapList") List<Map>  mapList);

    /**
     * 批量删除 角色权限表
     * @param roleId
     * @return
     */
    int batchDeleteRoleAndPerm(@Param("roleId") String roleId, @Param("ids") List<String>  ids);


    /**
     * 查找角色拥有的权限
     * @param roleId
     * @return
     */
    List< MenuTreeVo> findRoleHavePerm(@Param("roleId") String roleId);
}